from flask import jsonify
import json

def success_res(data=[]):
    return json.dumps({
        'code': 1,
        'msg': '',
        'data': data
        }, ensure_ascii=False)

def fail_res(msg="", data=""):
    return json.dumps({
        'code': 0,
        'msg': msg,
        'data': data
    })


def float2percent(num: float):
    return f'{round(num, 4) * 100}%'
